<?php

/*
 * error reporting on
 */

error_reporting(E_ALL ^ E_NOTICE);

/*
 * define the sitepath OM SPAN/
 */

$sitepath = realpath(dirname(__FILE__));
define('ROOT',$sitepath);

//echo $sitepath;

/*
 * define the sitepath url
 */

$base_url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']).'/';

define('URL',$base_url);

/*
 * define role
 */
define('SUPERADMIN','superadmin');
define('ADMIN','admin');
define('SATKER','satker');
define('KPPN','kppn');
define('PKN','pkn');
define('KANWIL','kanwil');
define('DJA','dja');
define('BLU','blu');
define('BANK','bank');
define('KL','kl');
define('ES1','es1');
define('UMADMIN','umadmin');
define('MENKEU','menkeu');
define('SA','sa');
define('PM','pm');
define('GR','gr');
define('BC','bc');
define('GLPDR','glpdr');
define('APK','apk');
define('PNR','pnr');

$path = array(
    ROOT.'/libs/',
    ROOT.'/app/controllers/',
    ROOT.'/app/models/'
);

//include ROOT.'/config/config.php';
include ROOT.'/libs/Autoloader.php';
//include ROOT.'/libs/config.php';
$FILE = dirname(__DIR__).'/local/config.php';

if (is_file($FILE)) {
    include($FILE);
}
include ROOT.'/app/akses.php';

Autoloader::setCacheFilePath(ROOT.'/libs/cache.txt');
Autoloader::setClassPaths($path);
Autoloader::register();
$registry = new Registry();
//$registry->upload = new Upload();
$registry->view = new View();
$registry->db = new Database();
$registry->auth = new Auth();

include ROOT.'/role/level.php';

$registry->exception = new ClassException();
$registry->bootstrap = new Bootstrap($registry);

$registry->bootstrap->loader();
